<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title><?php echo $this->pageTitle ?></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <!--[if lt IE 9]>
          <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <link href="<?php echo FRONT_SITE_URL ?>www/css/bootstrap.min.css" rel="stylesheet">
        <link href="<?php echo FRONT_SITE_URL ?>www/css/bootstrap-responsive.css" rel="stylesheet">
        <link href="<?php echo FRONT_SITE_URL ?>www/css/style.css" rel="stylesheet">
    </head>

    <body class="preview" id="top" data-spy="scroll" data-target=".subnav" data-offset="80">
        <!-- Navbar
          ================================================== -->
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container">
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </a>
                    <a class="brand" href="<?php echo bu() ?>">MyProject</a>
                    <div class="nav-collapse collapse" id="main-menu">
                        <?php $this->widget('bootstrap.widgets.TbMenu', array(
                            'items' => array(
                                array('label' => 'Home', 'url' => array('/site/index')),
                                array('label' => 'About', 'url' => array('/site/page', 'alias' => 'about')),
                                array('label' => 'Contact', 'url' => array('/site/page', 'alias' => 'contact')),
                                array('label' => 'Blog', 'url' => array('/blog/post'), 'active'=>$this->id=='post'?true:false),
                                array('label' => 'Login', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest),
                                array('label' => 'Register', 'url' => array('/user/register'), 'visible' => Yii::app()->user->isGuest, 'active'=>$this->id=='register'?true:false),
                                array('label' => 'Profile', 'url' => array('/user/profile'), 'visible' => !Yii::app()->user->isGuest, 'active'=>$this->id=='profile'?true:false),
                                array('label' => 'Logout (' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest)
                            ),
                        )) ?>
                    </div>
                </div>
            </div>
        </div>

        <div class="container">
            <?php
            $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
                'links' => $this->breadcrumbs,
                'encodeLabel' => FALSE,
            ));
            ?>

            <?php if(user()->hasFlash('success')) : ?>
            <div class="alert alert-success">
                <?php echo user()->getFlash('success') ?>
            </div>
            <?php endif; ?>
            <?php if(user()->hasFlash('error')) : ?>
            <div class="alert alert-error">
                <?php echo user()->getFlash('error') ?>
            </div>
            <?php endif; ?>
            <?php if(user()->hasFlash('info')) : ?>
            <div class="alert alert-info">
                <?php echo user()->getFlash('info') ?>
            </div>
            <?php endif; ?>
            <?php if(user()->hasFlash('danger')) : ?>
            <div class="alert alert-danger">
                <?php echo user()->getFlash('danger') ?>
            </div>
            <?php endif; ?>
            <?php if(user()->hasFlash('block')) : ?>
            <div class="alert alert-block">
                <?php echo user()->getFlash('block') ?>
            </div>
            <?php endif; ?>

            <?php echo $content ?>
            <!-- Footer
             ================================================== -->
            <hr>

            <footer id="footer">
                <div class="pull-right">
                    <?php $this->widget('application.widgets.newsletter.WNewsletterForm') ?>
                    <a href="#top">Back to top</a>
                </div>
                <div class="links">
                    <a href="<?php echo url('/blog') ?>">Blog</a>
                    <a href="#">RSS</a>
                </div>
                Made by <a href="mailto:tuong.tran@outlook.com">Tuong Tran</a>.<br/>
            </footer>

        </div><!-- /container -->
    </body>
</html>